package com.happyhome.datamodel;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * The persistent class for the district database table.
 * 
 */
@Entity
@Table(name="DISTRICT")
public class District implements Serializable {
	private static final long serialVersionUID = 1L;
	private Long idDistrict;
	private String codeDistrict;
	private String nameDistrict;
	private boolean status;
	private Province province;
	private Set<House> houses = new HashSet<House>();
	public District() {
	}


	@Id
	@Column(name="ID_DISTRICT")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getIdDistrict() {
		return this.idDistrict;
	}

	public void setIdDistrict(Long idDistrict) {
		this.idDistrict = idDistrict;
	}


	@Column(name="CODE_DISTRICT")
	public String getCodeDistrict() {
		return this.codeDistrict;
	}

	public void setCodeDistrict(String codeDistrict) {
		this.codeDistrict = codeDistrict;
	}


	@Column(name="NAME_DISTRICT")
	public String getNameDistrict() {
		return this.nameDistrict;
	}

	public void setNameDistrict(String nameDistrict) {
		this.nameDistrict = nameDistrict;
	}

	@Column(name="STATUS")
	public boolean getStatus() {
		return this.status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	//bi-directional many-to-one association to Province
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="PROVINCE_ID")
	public Province getProvince() {
		return this.province;
	}

	public void setProvince(Province province) {
		this.province = province;
	}


	//bi-directional many-to-one association to House
	@OneToMany(mappedBy="district", fetch = FetchType.LAZY)
	public Set<House> getHouses() {
		return this.houses;
	}

	public void setHouses(
			Set<House> houses) {
		this.houses = houses;
	}
}